﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Twipler.Xtensions
{
    public static class CharHelper
    {
        public static bool Is_az(this char c)
        {
            return ((c >= 'a') && (c <= 'z'));
        }

        public static bool Is_AZ(this char c)
        {
            return ((c >= 'A') && (c <= 'Z'));
        }

        public static bool Is_09(this char c)
        {
            return ((c >= '0') && (c <= '9'));
        }

        public static bool Is_azAZ09(this char c)
        {
            return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'));
        }

		public static bool IsIn(this char c, string whitelist)
		{
			return (whitelist.IndexOf(c) == -1);
		}


        public static bool Is_UrlValid(this char c)
        {
            return c.Is_azAZ09() || "?&_-=.:;@%/~#".IndexOf(c) != -1;
        }
    }
}
